package com.linkhub.oms.common.constant;

/**
 * @author Jaycle
 * @version 1.0.0
 * @Description WmsInfoConstant.java
 * @createTime 2024/06/14 22:47
 */

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class WmsInfoConstant {

    public static final String SYNC_ADD_PRODUCT = "add";
    public static final String SYNC_UPDATE_PRODUCT = "update";

    public static final String SYNC_PRODUCT_DEFAULT_CATEGORY_NAME = "Default";
    public static final String XSDD = "XSDD";

    public static final String CNJG = "CNJG";

    public static final String ZC = "ZC";

    public static final String ZH = "ZH";

    public static final String BC = "BC";

    public static final String OTHER = "OTHER";

    // 组合加工
    public static final String COMBINATION_PROCESSING = "1";
    // 拆解加工
    public static final String DISASSEMBLY_PROCESSING = "2";

    public static final String PACKING_LIST_PDF_NAME = "装箱单.pdf";
    public static final String SHIPPING_LABEL_PDF_NAME = "[面单.pdf]";

    public static final String CUSTOM_JSON_STRING ="{\"is_create_waybill\":true,\"waybill_url\":\"[面单.pdf]\"}";

    // 入库单确认
    public static final String WMS_OPENAPI_ENTRYORDER_CONFIRM = "openapi.entryorder.confirm";
    // 出库单确认
    public static final String WMS_OPENAPI_STOCKOUT_CONFIRM = "openapi.stockout.confirm";
    // 库存盘点通知
    public static final String WMS_OPENAPI_INVENTORY_REPORT = "openapi.inventory.report";
    // 加工单确认
    public static final String WMS_OPENAPI_STOREPROCESS_CONFIRM = "openapi.storeprocess.confirm";
    // 转移单确认
    public static final String WMS_OPENAPI_ADJUSTMENTORDER_CONFIRM = "openapi.adjustmentorder.confirm";
    // 加工单基础费用系数
    public static final Float WMS_PROCESS_ORDER_BASE_FEE = 0.3F;
    // 加工单额外商品费用系数
    public static final Float WMS_PROCESS_ORDER_EXTEND_FEE = 0.05F;

    // WMS API重试间隔（分钟），同一个订单多次调用不能短于此间隔
    public static final int WMS_API_RETRY_INTERVAL = 4;


    // 使用 @Value 注解注入非静态变量
    @Value("${wms.warehouseCode}")
    private String warehouseCode;

    // 定义一个静态变量来存储注入的值
    public static String WAREHOUSE_CODE;

    // 使用 @Value 注解注入非静态变量
    @Value("${wms.customerId}")
    private String ownerCode;

    // 定义一个静态变量来存储注入的值
    public static String OWNER_CODE;

    // 批量创建入库单确认接口
    @Value("${wms.batchCreateEntryOrderNotificationURL}")
    private String batchCreateEntryOrderNotificationURL;

    // 定义一个静态变量来存储注入的值
    public static String BATCH_CREATE_ENTRY_ORDER_NOTIFICATION_URL;

    // 批量创建出库单确认接口
    @Value("${wms.batchCreateStockOutListNotificationURL}")
    private String batchCreateStockOutListNotificationURL;

    // 定义一个静态变量来存储注入的值
    public static String BATCH_CREATE_STOCK_OUT_LIST_NOTIFICATION_URL;

    // 加工单确认接口
    @Value("${wms.storeProcessNotificationURL}")
    private String storeProcessNotificationURL;

    // 定义一个静态变量来存储注入的值
    public static String STORE_PROCESS_NOTIFICATION_URL;

    // 在 Spring 初始化 bean 后执行的方法
    @PostConstruct
    public void init() {
        // 将注入的值赋给静态变量
        WAREHOUSE_CODE = this.warehouseCode;
        OWNER_CODE = this.ownerCode;
        BATCH_CREATE_ENTRY_ORDER_NOTIFICATION_URL = this.batchCreateEntryOrderNotificationURL;
        BATCH_CREATE_STOCK_OUT_LIST_NOTIFICATION_URL = this.batchCreateStockOutListNotificationURL;
        STORE_PROCESS_NOTIFICATION_URL = this.storeProcessNotificationURL;
    }
}
